home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / libs / x / xview / xview3.004 / xview3 / usr / openwin / include / xview_private / nint.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-29  |  4.5 KB  |  132 lines

  1. /*    @(#)nint.h 20.11 93/06/28 SMI    */
  2.  
  3. /*
  4.  *    (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents 
  5.  *    pending in the U.S. and foreign countries. See LEGAL NOTICE 
  6.  *    file for terms of the license.
  7.  */
  8.  
  9. /*
  10.  * Nint.h - Private header file for the interposer part of the notifier.
  11.  * The interposer is responsible for managing the interposition stack
  12.  * during notifications (callouts) to clients.  It is used both by the
  13.  * detector and the dispatcher parts of the notifier.
  14.  */
  15.  
  16. #ifndef    NINT_DEFINED
  17. #define    NINT_DEFINED
  18.  
  19. /*
  20. The interposition stack is independent of the detector and dispatcher.
  21. Interposition stuff is prefaced with nint_.  Interposition is only viable
  22. with static conditions.  The number of interpositions is limited
  23. to the max size of the fast allocaction node (about 6 levels deep).
  24. The truth of the function list (interposition list) is kept by the
  25. detector.
  26.  
  27. Keeping track of which function to call when running down the
  28. interposition list is done by maintaining an "interposition stack".
  29. This is a stack of conditions that currently have callouts outstanding.
  30.  
  31. Before an initial callout is made, a copy of the condition is pushed
  32. onto the top of the stack.  The first callout is made and the func_next
  33. index is set to 1.
  34.  
  35. When a notify_next_*_func call is made, the top of the interposition stack
  36. is supposed to be the relevent condition.  Some consistency checks are done
  37. to check this.  The next function for that condition is called.
  38.  
  39. When the initial callout returns, the condition is popped from the
  40. interposition stack.  If a condition is removed from the notifier that
  41. is currently on the interposition stack, nothing is done to the
  42. interposition stack.  It is assumed that higher levels of software
  43. wouldn't call notify_next_*_func for that condition.
  44.  
  45. ********************** Public Interface Supporting *********************
  46. The public programming interface that the interposer supports follows:
  47.  
  48. notify_interpose_input_func
  49. notify_interpose_output_func
  50. notify_interpose_exception_func
  51. notify_interpose_itimer_func
  52. notify_interpose_signal_func
  53. notify_interpose_wait3_func
  54. notify_interpose_destroy_func
  55. notify_interpose_event_func
  56.  
  57. notify_next_input_func
  58. notify_next_output_func
  59. notify_next_exception_func
  60. notify_next_itimer_func
  61. notify_next_signal_func
  62. notify_next_wait3_func
  63. notify_next_destroy_func
  64. notify_next_event_func
  65.  
  66. notify_remove_input_func
  67. notify_remove_output_func
  68. notify_remove_exception_func
  69. notify_remove_itimer_func
  70. notify_remove_signal_func
  71. notify_remove_wait3_func
  72. notify_remove_destroy_func
  73. notify_remove_event_func
  74.  
  75. */
  76.  
  77. /* Private to interposer */
  78. extern    NTFY_CONDITION *nint_stack;    /* Condition stack */
  79. extern    int nint_stack_size;        /* Length of condition stack */
  80. extern    int nint_stack_next;        /* Next empty slot in condition stack */
  81. extern    Notify_error nint_alloc_stack();/* (Pre)allocate enough stack space */
  82.  
  83. extern    Notify_func nint_set_func();    /* (NTFY_CONDITION *cond,
  84.                         Notify_func new_func)
  85.                        Call while in critical section. */
  86. extern    Notify_func nint_get_func();    /* (NTFY_CONDITION *cond)
  87.                        Call while in critical section. */
  88.  
  89. extern    Notify_error nint_interpose_func();    /* (Notify_client nclient,
  90.                             Notify_func func,
  91.                             NTFY_TYPE type,
  92.                             caddr_t data,
  93.                             int use_data) */
  94. extern    Notify_error nint_remove_func();    /* (Notify_client nclient,
  95.                             Notify_func func,
  96.                             NTFY_TYPE type,
  97.                             caddr_t data,
  98.                             int use_data) */
  99.  
  100. extern    Notify_error nint_interpose_fd_func();    /* (Notify_client nclient,
  101.                             Notify_func func,
  102.                             NTFY_TYPE type,
  103.                             int fd) */
  104. extern    Notify_value nint_next_fd_func();    /* (Notify_client nclient,
  105.                             NTFY_TYPE type,
  106.                             int fd) */
  107. extern    Notify_error nint_remove_fd_func();    /* (Notify_client nclient,
  108.                             Notify_func func,
  109.                             NTFY_TYPE type,
  110.                             int fd) */
  111.  
  112. extern    Notify_error nint_copy_callout();    /* (NTFY_CONDITION *new_cond,
  113.                             NTFY_CONDITION *old_cond)
  114.                            Overwrites new_cond->callout
  115.                            with newly allocated node
  116.                            filled with old_cond stuff */
  117.  
  118. extern    Notify_func nint_push_callout();    /* (NTFY_CLIENT *client,
  119.                             NTFY_CONDITION *cond)
  120.                            Assumes being called while
  121.                            critical area protected. */
  122. extern    Notify_func nint_next_callout();    /* (Notify_client nclient,
  123.                             NTFY_TYPE type) */
  124. extern    void nint_pop_callout();        /* () Enters critical section
  125.                            to do work. */
  126. extern    void nint_unprotected_pop_callout();    /* () Like
  127.                            nint_pop_callout exceptdoes
  128.                            assumes in critical section*/
  129.  
  130. #endif    NINT_DEFINED
  131.  
  132.